home *** CD-ROM | disk | FTP | other *** search
/ PC Player 2004 May / pc player 2004-05.iso / Demos / FarCry / Data1.cab / _0CE86139724D47C7B2100AB8802AB105 < prev    next >
Encoding:
Text File  |  2004-01-06  |  1.1 KB  |  33 lines

  1.       #include "../CGVPMacro.csi"
  2.  
  3.       MainInput { uniform sampler2D baseMap : texunit0,
  4.                   uniform sampler2D bumpMap : texunit1,
  5.                   uniform sampler2D lightMap : texunit2,
  6.                   uniform sampler2D lightDirMap : texunit3,
  7.                   uniform float4 Ambient }
  8.       DeclarationsScript
  9.       {
  10.         OUT_T0_T1_T2_T3
  11.         FOUT
  12.       }
  13.       CoreScript
  14.       {
  15.         // load the decal
  16.         float4 decalColor = tex2D(baseMap, IN.Tex0.xy);
  17.         // load the bump normal
  18.         float4 bumpNormal = 2*(tex2D(bumpMap, IN.Tex1.xy)-0.5);
  19.         // load the lm
  20.         float4 lmColor = tex2D(lightMap, IN.Tex2.xy);
  21.         // load the lm dir
  22.         float4 lmDir = 2*(tex2D(lightDirMap, IN.Tex3.xy)-0.5);
  23.  
  24.         float NdotL = saturate(dot(lmDir.xyz, bumpNormal.xyz));
  25.         float  lmIntens = NdotL * lmColor.a + (1-lmColor.a);
  26.         float3 dif = (decalColor.xyz * lmColor.xyz * lmIntens) * 4;
  27.  
  28.         // finally add them all together
  29.         OUT.Color.xyz = dif;
  30.         OUT.Color.w = decalColor.w * Ambient.w;
  31.       }
  32.  
  33.